

using System;
using System.Collections.Generic;
using System.Text;
using DataAccessLayer;
using EntityLayer;
using DataLayer;
using System.Data;
using InfraStructureLayer;

namespace BusinessLayer
{
	public class busPages:BusinessBase
	{
		public busPages() : base()
		{
		}
        #region  Code Factory Generated Methods

        public void InsertPages(entPages parEntPages)
        {
            datPages insDatPages = null;
            DbConnector insDbConnector = new DbConnector();
            try
            {
                insDatPages = new datPages();
                insDatPages.InsertPages(parEntPages, insDbConnector);
            }
            catch (SFException ex)
            {
                this.ErrorMessage = ex.Message;
            }
        }
        public void UpdatePagesByPageId(entPages parEntPages)
        {

            datPages insDatPages = null;
            DbConnector insDbConnector = new DbConnector();
            try
            {
                insDatPages = new datPages();
                insDatPages.UpdatePagesByPageId(parEntPages, insDbConnector);
            }
            catch (SFException ex)
            {
                this.ErrorMessage = ex.Message;
            }
        }
        public DataTable SelectPages()
        {
            try
            {
                datPages insDatPages = new datPages();
                DbConnector insDbConnector = new DbConnector();
                return insDatPages.SelectPages(insDbConnector);
            }
            catch (SFException ex)
            {
                this.ErrorMessage = ex.Message;
            }
            return null;
        }
        public void SelectPagesByPageId(entPages parEntPages)
        {
            try
            {
                datPages insDatPages = new datPages();
                DbConnector insDbConnector = new DbConnector();
                insDatPages.SelectPagesByPageId(parEntPages, insDbConnector);
            }
            catch (SFException ex)
            {
                this.ErrorMessage = ex.Message;
            }
        }
        
        #endregion

        public void DeletePagesByPageId(entPages parEntPages)
        {
            DbConnector insDbConnector = new DbConnector();
            try
            {
                insDbConnector.BeginTransaction();

                datMultilanguageSettings insDatMultilanguageSettings = new datMultilanguageSettings();
                entMultilanguageSettings insEntMultilanguageSettings = new entMultilanguageSettings();
                insEntMultilanguageSettings.PageId = parEntPages.PageId;
                insDatMultilanguageSettings.DeleteMultilanguageSettingsByPageId(insEntMultilanguageSettings, insDbConnector);

                datPages insDatPages = new datPages();
                insDatPages.DeletePagesByPageId(parEntPages, insDbConnector);

                insDbConnector.CommitTransaction();
            }
            catch (SFException ex)
            {
                insDbConnector.RollbackTransaction();
                this.ErrorMessage = ex.Message;
            }
            catch (Exception ex)
            {
                insDbConnector.RollbackTransaction();
                throw new SFUnHandledException(ex);
            }
        }
	}
}